<#ibizinclude>
../@MACRO/MODEL/MODEL_HEADER.ts.ftl
</#ibizinclude>

	/**
	 * 日历项类型
	 *
	 * @returns {any[]}
	 * @memberof ${srfclassname('${ctrl.getCodeName()}')}${srfclassname('${ctrl.name}')}Mode
	 */
	public itemType: string = "";

	/**
	 * 获取数据项集合
	 *
	 * @returns {any[]}
	 * @memberof ${srfclassname('${ctrl.getCodeName()}')}${srfclassname('${ctrl.name}')}Mode
	 */
	public getDataItems(): any[] {
     let dataItems: any = [
<#--  关联主实体的主键  -->
<#if ctrl.getPSAppDataEntity()??>
  <#assign appDataEntity = ctrl.getPSAppDataEntity() />
  <#if appDataEntity.isMajor() == false && appDataEntity.getMinorPSAppDERSs()??>
    <#list appDataEntity.getMinorPSAppDERSs() as minorAppDERSs>
      <#if minorAppDERSs.getMajorPSAppDataEntity()??>
      <#assign majorAppDataEntity = minorAppDERSs.getMajorPSAppDataEntity() />
          {
            name: '${majorAppDataEntity.getCodeName()?lower_case}',
            prop: '${majorAppDataEntity.getKeyPSAppDEField().getCodeName()?lower_case}'
          },
      </#if>
    </#list>
  </#if>
</#if>
<#if view.hasPSControl('searchform')>
${P.getCtrlCode('searchform', 'MODEL_CONTENT.ts').code}
</#if>
          // 前端新增修改标识，新增为"0",修改为"1"或未设值
          {
            name: 'srffrontuf',
            prop: 'srffrontuf',
            dataType: 'TEXT',
          },
          {
            name: 'color',
          },
          {
            name: 'textColor',
          },
          {
            name: 'itemType',
          },
          {
            name: 'query',
            prop: 'query',
          },
      ];
      switch(this.itemType){
    <#--  日历项实体映射  -->
<#if ctrl.getPSSysCalendarItems()??>
  <#list ctrl.getPSSysCalendarItems() as calendarItem>
    <#if calendarItem.getPSAppDataEntity()??>
      <#assign appDataEntity = calendarItem.getPSAppDataEntity() />
          case "${calendarItem.getItemType()}":
              dataItems = [...dataItems,
                  {
                    name: '${appDataEntity.getCodeName()?lower_case}',
                    prop: '<#if calendarItem.getIdPSAppDEField()??>${calendarItem.getIdPSAppDEField().getCodeName()?lower_case}<#else>${appDataEntity.getKeyPSAppDEField().getCodeName()?lower_case}</#if>'
                  },
                  {
                    name: 'title',
                    prop: '<#if calendarItem.getTextPSAppDEField()??>${calendarItem.getTextPSAppDEField().getCodeName()?lower_case}<#else>${appDataEntity.getMajorPSAppDEField().getCodeName()?lower_case}</#if>'
                  },
                  {
                    name:'start',
                    prop:'${calendarItem.getBeginTimePSDEField().getCodeName()?lower_case}'
                  },
                  {
                    name:'end',
                    prop:'${calendarItem.getEndTimePSDEField().getCodeName()?lower_case}'
                  },
              ];
              break;
    </#if>
  </#list>
</#if>
      }
      return dataItems;
	}

<#ibizinclude>
../@MACRO/MODEL/MODEL_BOTTOM.ts.ftl
</#ibizinclude>